package com.czl.module_storehouse.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.czl.base.data.bean.tengyun.SortBean;
import com.czl.module_storehouse.R;
import com.lihang.ShadowLayout;

import java.util.List;

/**
 * @author xubin
 */
public class InventoryDetailsAdapter extends BaseQuickAdapter<SortBean, BaseViewHolder> {

    public InventoryDetailsAdapter(int layoutResId, @Nullable List<SortBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, SortBean item) {
        helper.setText(R.id.tv_title, item.getSortName())
                .setText(R.id.tv_model, "型号：" + item.getSortModel())
                .setText(R.id.tv_count, "数量：" + item.getStockNum())
                .setText(R.id.text_receive, "盘盈：")
                .setText(R.id.tv_num, String.valueOf(item.getSurplusNum()))
                .setText(R.id.tv_loss, "盘亏：")
                .setText(R.id.tv_loss_num, String.valueOf(item.getLossesNum()));
        ShadowLayout shadowLayout = helper.getView(R.id.shadowLayout);
        shadowLayout.setShadowHiddenBottom(helper.getLayoutPosition() != getDefItemCount() - 1);
    }
}
